package com.fmc123.base.web;

import com.google.gson.Gson;

/**
 * DWZ框架返回信息封装
* @ClassName: DWZRender
* @Description: TODO 
* @author fmc
* @date 2015年11月27日下午9:55:53
*
 */
public class DWZRender implements Render{
  /**
   * 
   {"statusCode":"200", "message":"操作成功", "navTabId":"navNewsLi", "forwardUrl":"", "callbackType":"closeCurrent", "rel"."xxxId"}
 * {"statusCode":"300", "message":"操作失败"}
 * {"statusCode":"301", "message":"会话超时"}
   */  
  //状态码：200操作成功，300操作失败，301会话超时
  private   String statusCode="200";
  //提示信息
  private   String message="操作成功";
  //navTab的id
  private   String navTabId="";
  //
  private   String rel="";
  //
  private   String callbackType="";
  //跳转url
  private   String forwardUrl="";
  //
  private   String confirmMsg="";
  
  private static Gson gson=new Gson();
  
  @Override
  public String render(){
    return gson.toJson(this);
  }
  
  @Override
  public String renderOk(){
    this.statusCode="200";//重置状态
    this.message="操作成功";//重置提示语
    return gson.toJson(this);
  }
  
  @Override
  public String renderError(){
    this.statusCode="300";
    this.message="操作失败";
    return gson.toJson(this);
  }
  
  public String getStatusCode() {
    return statusCode;
  }
  public void setStatusCode(String statusCode) {
    this.statusCode = statusCode;
  }
  public String getMessage() {
    return message;
  }
  public void setMessage(String message) {
    this.message = message;
  }
  public String getNavTabId() {
    return navTabId;
  }
  public void setNavTabId(String navTabId) {
    this.navTabId = navTabId;
  }
  public String getRel() {
    return rel;
  }
  public void setRel(String rel) {
    this.rel = rel;
  }
  public String getCallbackType() {
    return callbackType;
  }
  public void setCallbackType(String callbackType) {
    this.callbackType = callbackType;
  }
  public String getForwardUrl() {
    return forwardUrl;
  }
  public void setForwardUrl(String forwardUrl) {
    this.forwardUrl = forwardUrl;
  }
  public String getConfirmMsg() {
    return confirmMsg;
  }
  public void setConfirmMsg(String confirmMsg) {
    this.confirmMsg = confirmMsg;
  }
  
  public static void main(String[] args) {
    DWZRender render= new DWZRender();
    String gson=render.renderOk();
    System.out.println(gson);
  }
  
  
}
